function C_prepareNIDisplay(ID,Force)

global CG; if nargin < 1 ID = 1; end

if exist('Force','var') && Force == 1 
  try; close(CG.Display.NI(ID).FIG); end
end

% CHECK IF FIGURE ALREADY EXISTS
if ~isfield(CG.Display,'NI') | ID>length(CG.Display.NI) | ~isfield(CG.Display.NI(ID),'FIG') | ...
    isempty(CG.Display.NI(ID).FIG) | ~ishandle(CG.Display.NI(ID).FIG)
   
  % COMPUTE POSITION OF FIGURE
  FigureSize = [200,500];
  cFIG = C_createModuleFigure('NI',ID,FigureSize);
  set(cFIG,'Toolbar','Figure')
  NAnalogIn = CG.Sessions.NI(ID).NAnalogIn;
  NDigitalOut = CG.Sessions.NI(ID).NDigitalOut;

  % PREPARE PLOTS ON FIGURE
  DC = axesDivide(1,[0.07,1],[0.18,0.09,0.76,0.875],[],[0.1]);
  
  FontSize = 6;
  TextOpt = {'Horiz','Right','FontSize',FontSize};
  SeparatorColor = [0.5,0.5,0.5];
  SpacingFactor = 1.2;
  CG.Display.NI(ID).PacketsDisplayed = round(CG.Sessions.NI(ID).SAI.Rate*CG.Display.NI(ID).DisplayDuration);
  Packets = [ -CG.Display.NI(ID).PacketsDisplayed : -1];
  Data0 = zeros(size(Packets));
  CG.Display.NI(ID).DigitalColors = {[1,0,0],[0,1,0]};
  
  if NDigitalOut > 0
    AH(1) = axes('Position',DC{1}); hold on; box off;
    for iP=1:NDigitalOut
      CG.Display.NI(ID).DigitalPH(iP) = ...
        plot(AH(1),iP,0,'Color',CG.Display.NI(ID).DigitalColors{1},'Marker','.','MarkerSize',30);
    end
    text(0,0,'DIO','FontSize',FontSize,'Horiz','right');
    set(AH(1),'YTick',[],'YLim',[-0.5,0.5],'XLim',[0.5,NDigitalOut+0.5],...
      'XTick',[1:NDigitalOut],'XTickLabel',{CG.Sessions.NI(ID).SD.Channels.Name},...
      'FontSize',FontSize,'YColor',[1,1,1]);
    CG.Display.NI(ID).AH.DataDigital = AH(1);
  end
    
  if NAnalogIn > 0
    AH(2) = axes('Position',DC{2}); hold on; box on;
    for iP=NAnalogIn:-1:1
      % PLOT MINIMAL AND MAXIMAL LINES
      CG.Display.NI(ID).AnalogOffset(iP) = iP*CG.Parameters.NI.AnalogRange(2)*SpacingFactor;
      plot(AH(2),Packets([1,end]),repmat(CG.Display.NI(ID).AnalogOffset(iP),1,2),'Color',SeparatorColor);
      plot(AH(2),Packets([1,end]),repmat(CG.Display.NI(ID).AnalogOffset(iP)+CG.Parameters.NI.AnalogRange(2),1,2),'Color',SeparatorColor);
      
      % PLOT THRESHOLDS
      cThreshold = CG.Sessions.NI(ID).AnalogThresholds(iP);
      plot(AH(2),Packets([1,end]),repmat(CG.Display.NI(ID).AnalogOffset(iP) +cThreshold ,1,2),'Color',[1,0,0]);
      
      % PREPARE PLOTS FOR ANALOG
      CG.Display.NI(ID).AnalogPH(iP) = plot(AH(2),Packets,Data0+CG.Display.NI(ID).AnalogOffset(iP),'Color',hsv2rgb([0.6,1,1]));
      
      % PREPARE TEXT ON FIGURE
      CG.Display.NI(ID).AnalogLabel(iP,1) = ...
        text(1.05*Packets(1),CG.Display.NI(ID).AnalogOffset(iP)+0.5*CG.Parameters.NI.AnalogRange(2) ,...
        upper([CG.Sessions.NI(ID).SAI.Channels(iP).ID]),TextOpt{:});
      CG.Display.NI(ID).AnalogLabel(iP,2) = ...
        text(1.05*Packets(1),CG.Display.NI(ID).AnalogOffset(iP)-0*CG.Parameters.NI.AnalogRange(2) ,...
        CG.Sessions.NI(ID).SAI.Channels(iP).Name,TextOpt{:});
      CG.Display.NI(ID).AnalogVal(iP) = ...
        text(Packets(end)-5,CG.Display.NI(ID).AnalogOffset(iP)+0.5*CG.Parameters.NI.AnalogRange(2) ,['0V'],TextOpt{:},'FontSize',6);
    end
    set(AH(2),'YTick',[],'YLim',[CG.Parameters.NI.AnalogRange(2)/2,CG.Display.NI(ID).AnalogOffset(end)+0.6*CG.Parameters.NI.AnalogRange(2)],...
      'XLim',[Packets([1]),0],'XTick',[Packets([1,round(length(Packets)/2)]),0],...
      'XTickLabel',[Packets([1,round(length(Packets)/2+1)]),0]/CG.Sessions.NI(ID).SAI.Rate,...
      'FontSize',FontSize);
    CG.Display.NI(ID).AH.DataAnalog = AH(2);
  end
    % PREPARE TEXT ON FIGURE
  CG.Display.NI(ID).TimeH = text(1.05,-0.08,['Time Acquired = 0s'],'Units','n','Horiz','Right','FontSize',FontSize);  
end
